home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / necko / nsIIncrementalDownload.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  10KB  |  246 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIIncrementalDownload.idl
  3.  */
  4.  
  5. #ifndef __gen_nsIIncrementalDownload_h__
  6. #define __gen_nsIIncrementalDownload_h__
  7.  
  8.  
  9. #ifndef __gen_nsIRequest_h__
  10. #include "nsIRequest.h"
  11. #endif
  12.  
  13. /* For IDL files that don't want to include root IDL files. */
  14. #ifndef NS_NO_VTABLE
  15. #define NS_NO_VTABLE
  16. #endif
  17. class nsIURI; /* forward declaration */
  18.  
  19. class nsIFile; /* forward declaration */
  20.  
  21. class nsIRequestObserver; /* forward declaration */
  22.  
  23.  
  24. /* starting interface:    nsIIncrementalDownload */
  25. #define NS_IINCREMENTALDOWNLOAD_IID_STR "6687823f-56c4-461d-93a1-7f6cb7dfbfba"
  26.  
  27. #define NS_IINCREMENTALDOWNLOAD_IID \
  28.   {0x6687823f, 0x56c4, 0x461d, \
  29.     { 0x93, 0xa1, 0x7f, 0x6c, 0xb7, 0xdf, 0xbf, 0xba }}
  30.  
  31. /**
  32.  * An incremental download object attempts to fetch a file piecemeal over time
  33.  * in an effort to minimize network bandwidth usage.
  34.  *
  35.  * Canceling a background download does not cause the file on disk to be
  36.  * deleted.
  37.  */
  38. class NS_NO_VTABLE nsIIncrementalDownload : public nsIRequest {
  39.  public: 
  40.  
  41.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IINCREMENTALDOWNLOAD_IID)
  42.  
  43.   /**
  44.    * Initialize the incremental download object.  If the destination file
  45.    * already exists, then only the remaining portion of the file will be
  46.    * fetched.
  47.    *
  48.    * NOTE: The downloader will create the destination file if it does not
  49.    * already exist.  It will create the file with the permissions 0600 if
  50.    * needed.  To affect the permissions of the file, consumers of this
  51.    * interface may create an empty file at the specified destination prior to
  52.    * starting the incremental download.
  53.    *
  54.    * NOTE: Since this class may create a temporary file at the specified
  55.    * destination, it is advisable for the consumer of this interface to specify
  56.    * a file name for the destination that would not tempt the user into
  57.    * double-clicking it.  For example, it might be wise to append a file
  58.    * extension like ".part" to the end of the destination to protect users from
  59.    * accidentally running "blah.exe" before it is a complete file.
  60.    *
  61.    * @param uri
  62.    *        The URI to fetch.
  63.    * @param destination
  64.    *        The location where the file is to be stored.
  65.    * @param chunkSize
  66.    *        The size of the chunks to fetch.  A non-positive value results in
  67.    *        the default chunk size being used.
  68.    * @param intervalInSeconds
  69.    *        The amount of time to wait between fetching chunks.  Pass a
  70.    *        negative to use the default interval, or 0 to fetch the remaining
  71.    *        part of the file in one chunk.
  72.    */
  73.   /* void init (in nsIURI uri, in nsIFile destination, in long chunkSize, in long intervalInSeconds); */
  74.   NS_IMETHOD Init(nsIURI *uri, nsIFile *destination, PRInt32 chunkSize, PRInt32 intervalInSeconds) = 0;
  75.  
  76.   /**
  77.    * The URI being fetched.
  78.    */
  79.   /* readonly attribute nsIURI URI; */
  80.   NS_IMETHOD GetURI(nsIURI * *aURI) = 0;
  81.  
  82.   /**
  83.    * The URI being fetched after any redirects have been followed.  This
  84.    * attribute is set just prior to calling OnStartRequest on the observer
  85.    * passed to the start method.
  86.    */
  87.   /* readonly attribute nsIURI finalURI; */
  88.   NS_IMETHOD GetFinalURI(nsIURI * *aFinalURI) = 0;
  89.  
  90.   /**
  91.    * The file where the download is being written.
  92.    */
  93.   /* readonly attribute nsIFile destination; */
  94.   NS_IMETHOD GetDestination(nsIFile * *aDestination) = 0;
  95.  
  96.   /**
  97.    * The total number of bytes for the requested file.  This attribute is set
  98.    * just prior to calling OnStartRequest on the observer passed to the start
  99.    * method.
  100.    *
  101.    * This attribute has a value of -1 if the total size is unknown.
  102.    */
  103.   /* readonly attribute long long totalSize; */
  104.   NS_IMETHOD GetTotalSize(PRInt64 *aTotalSize) = 0;
  105.  
  106.   /**
  107.    * The current number of bytes downloaded so far.  This attribute is set just
  108.    * prior to calling OnStartRequest on the observer passed to the start
  109.    * method.
  110.    *
  111.    * This attribute has a value of -1 if the current size is unknown.
  112.    */
  113.   /* readonly attribute long long currentSize; */
  114.   NS_IMETHOD GetCurrentSize(PRInt64 *aCurrentSize) = 0;
  115.  
  116.   /**
  117.    * Start the incremental download.
  118.    *
  119.    * @param observer
  120.    *        An observer to be notified of various events.  OnStartRequest is
  121.    *        called when finalURI and totalSize have been determined or when an
  122.    *        error occurs.  OnStopRequest is called when the file is completely
  123.    *        downloaded or when an error occurs.  If this object implements
  124.    *        nsIProgressEventSink, then its OnProgress method will be called as
  125.    *        data is written to the destination file.  If this object implements
  126.    *        nsIInterfaceRequestor, then it will be assigned as the underlying
  127.    *        channel's notification callbacks, which allows it to provide a
  128.    *        nsIAuthPrompt implementation if needed by the channel, for example.
  129.    * @param ctxt
  130.    *        User defined object forwarded to the observer's methods.
  131.    */
  132.   /* void start (in nsIRequestObserver observer, in nsISupports ctxt); */
  133.   NS_IMETHOD Start(nsIRequestObserver *observer, nsISupports *ctxt) = 0;
  134.  
  135. };
  136.  
  137. /* Use this macro when declaring classes that implement this interface. */
  138. #define NS_DECL_NSIINCREMENTALDOWNLOAD \
  139.   NS_IMETHOD Init(nsIURI *uri, nsIFile *destination, PRInt32 chunkSize, PRInt32 intervalInSeconds); \
  140.   NS_IMETHOD GetURI(nsIURI * *aURI); \
  141.   NS_IMETHOD GetFinalURI(nsIURI * *aFinalURI); \
  142.   NS_IMETHOD GetDestination(nsIFile * *aDestination); \
  143.   NS_IMETHOD GetTotalSize(PRInt64 *aTotalSize); \
  144.   NS_IMETHOD GetCurrentSize(PRInt64 *aCurrentSize); \
  145.   NS_IMETHOD Start(nsIRequestObserver *observer, nsISupports *ctxt); 
  146.  
  147. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  148. #define NS_FORWARD_NSIINCREMENTALDOWNLOAD(_to) \
  149.   NS_IMETHOD Init(nsIURI *uri, nsIFile *destination, PRInt32 chunkSize, PRInt32 intervalInSeconds) { return _to Init(uri, destination, chunkSize, intervalInSeconds); } \
  150.   NS_IMETHOD GetURI(nsIURI * *aURI) { return _to GetURI(aURI); } \
  151.   NS_IMETHOD GetFinalURI(nsIURI * *aFinalURI) { return _to GetFinalURI(aFinalURI); } \
  152.   NS_IMETHOD GetDestination(nsIFile * *aDestination) { return _to GetDestination(aDestination); } \
  153.   NS_IMETHOD GetTotalSize(PRInt64 *aTotalSize) { return _to GetTotalSize(aTotalSize); } \
  154.   NS_IMETHOD GetCurrentSize(PRInt64 *aCurrentSize) { return _to GetCurrentSize(aCurrentSize); } \
  155.   NS_IMETHOD Start(nsIRequestObserver *observer, nsISupports *ctxt) { return _to Start(observer, ctxt); } 
  156.  
  157. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  158. #define NS_FORWARD_SAFE_NSIINCREMENTALDOWNLOAD(_to) \
  159.   NS_IMETHOD Init(nsIURI *uri, nsIFile *destination, PRInt32 chunkSize, PRInt32 intervalInSeconds) { return !_to ? NS_ERROR_NULL_POINTER : _to->Init(uri, destination, chunkSize, intervalInSeconds); } \
  160.   NS_IMETHOD GetURI(nsIURI * *aURI) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetURI(aURI); } \
  161.   NS_IMETHOD GetFinalURI(nsIURI * *aFinalURI) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetFinalURI(aFinalURI); } \
  162.   NS_IMETHOD GetDestination(nsIFile * *aDestination) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetDestination(aDestination); } \
  163.   NS_IMETHOD GetTotalSize(PRInt64 *aTotalSize) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetTotalSize(aTotalSize); } \
  164.   NS_IMETHOD GetCurrentSize(PRInt64 *aCurrentSize) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCurrentSize(aCurrentSize); } \
  165.   NS_IMETHOD Start(nsIRequestObserver *observer, nsISupports *ctxt) { return !_to ? NS_ERROR_NULL_POINTER : _to->Start(observer, ctxt); } 
  166.  
  167. #if 0
  168. /* Use the code below as a template for the implementation class for this interface. */
  169.  
  170. /* Header file */
  171. class nsIncrementalDownload : public nsIIncrementalDownload
  172. {
  173. public:
  174.   NS_DECL_ISUPPORTS
  175.   NS_DECL_NSIINCREMENTALDOWNLOAD
  176.  
  177.   nsIncrementalDownload();
  178.  
  179. private:
  180.   ~nsIncrementalDownload();
  181.  
  182. protected:
  183.   /* additional members */
  184. };
  185.  
  186. /* Implementation file */
  187. NS_IMPL_ISUPPORTS1(nsIncrementalDownload, nsIIncrementalDownload)
  188.  
  189. nsIncrementalDownload::nsIncrementalDownload()
  190. {
  191.   /* member initializers and constructor code */
  192. }
  193.  
  194. nsIncrementalDownload::~nsIncrementalDownload()
  195. {
  196.   /* destructor code */
  197. }
  198.  
  199. /* void init (in nsIURI uri, in nsIFile destination, in long chunkSize, in long intervalInSeconds); */
  200. NS_IMETHODIMP nsIncrementalDownload::Init(nsIURI *uri, nsIFile *destination, PRInt32 chunkSize, PRInt32 intervalInSeconds)
  201. {
  202.     return NS_ERROR_NOT_IMPLEMENTED;
  203. }
  204.  
  205. /* readonly attribute nsIURI URI; */
  206. NS_IMETHODIMP nsIncrementalDownload::GetURI(nsIURI * *aURI)
  207. {
  208.     return NS_ERROR_NOT_IMPLEMENTED;
  209. }
  210.  
  211. /* readonly attribute nsIURI finalURI; */
  212. NS_IMETHODIMP nsIncrementalDownload::GetFinalURI(nsIURI * *aFinalURI)
  213. {
  214.     return NS_ERROR_NOT_IMPLEMENTED;
  215. }
  216.  
  217. /* readonly attribute nsIFile destination; */
  218. NS_IMETHODIMP nsIncrementalDownload::GetDestination(nsIFile * *aDestination)
  219. {
  220.     return NS_ERROR_NOT_IMPLEMENTED;
  221. }
  222.  
  223. /* readonly attribute long long totalSize; */
  224. NS_IMETHODIMP nsIncrementalDownload::GetTotalSize(PRInt64 *aTotalSize)
  225. {
  226.     return NS_ERROR_NOT_IMPLEMENTED;
  227. }
  228.  
  229. /* readonly attribute long long currentSize; */
  230. NS_IMETHODIMP nsIncrementalDownload::GetCurrentSize(PRInt64 *aCurrentSize)
  231. {
  232.     return NS_ERROR_NOT_IMPLEMENTED;
  233. }
  234.  
  235. /* void start (in nsIRequestObserver observer, in nsISupports ctxt); */
  236. NS_IMETHODIMP nsIncrementalDownload::Start(nsIRequestObserver *observer, nsISupports *ctxt)
  237. {
  238.     return NS_ERROR_NOT_IMPLEMENTED;
  239. }
  240.  
  241. /* End of implementation class template. */
  242. #endif
  243.  
  244.  
  245. #endif /* __gen_nsIIncrementalDownload_h__ */
  246.